home *** CD-ROM | disk | FTP | other *** search
/ Champak 142 / Volume 142 Oct 17 2011 - Damaged.iso / Games / operation-graduates.swf / scripts / frame_41 / DoAction_11.as < prev    next >
Text File  |  2011-10-17  |  2KB  |  73 lines

  1. function spawnDumbHomer(xSpot, difLevel)
  2. {
  3.    var _loc1_ = enemyContainer.attachMovie("dumbHomer" + difLevel,"enemy" + eConCount++,eConCount);
  4.    _loc1_._x = xSpot;
  5.    _loc1_._y = (- _loc1_._height) / 2;
  6.    _loc1_.homingsound = new Sound();
  7.    _loc1_.gotoAndStop(1);
  8.    _loc1_.energy = 15;
  9.    switch(difLevel)
  10.    {
  11.       case 1:
  12.          _loc1_.maxSpeed = 7;
  13.          break;
  14.       case 2:
  15.          _loc1_.maxSpeed = 10;
  16.    }
  17.    _loc1_.route = new Vector(0,_loc1_.maxSpeed);
  18.    _loc1_.move = dumbHomerMover;
  19.    _loc1_.moveHow = 0;
  20.    _loc1_.Q1logic = baddyQ1;
  21.    _loc1_.Q2logic = baddyQ2;
  22.    _loc1_.Q3logic = baddyQ3;
  23.    _loc1_.Q4logic = baddyQ4;
  24.    _loc1_.hit = dumbHomerHit;
  25.    _loc1_.isHit = false;
  26.    _loc1_.collide = baddyCollide;
  27. }
  28. function dumbHomerHit()
  29. {
  30.    var _loc1_ = this;
  31.    _loc1_.setRGB(16777215);
  32.    _loc1_.isHit = true;
  33.    _loc1_.energy -= 5;
  34.    if(_loc1_.energy <= 0)
  35.    {
  36.       playSound("sound.helix.explode");
  37.       explode(_loc1_);
  38.       addScore(150);
  39.       baddyKillCount++;
  40.    }
  41. }
  42. function dumbHomerMover()
  43. {
  44.    var _loc1_ = this;
  45.    if(_loc1_.isHit)
  46.    {
  47.       _loc1_.resetColor();
  48.       _loc1_.isHit = false;
  49.    }
  50.    _loc1_._x += _loc1_.route.x;
  51.    _loc1_._y += _loc1_.route.y;
  52.    if(_loc1_._y > 420 || _loc1_._x < 0 || _loc1_._x > 600)
  53.    {
  54.       _loc1_.removeMovieClip();
  55.    }
  56.    _loc1_._rotation = Math.atan2(_loc1_.route.y,_loc1_.route.x) * 57.29577951308232 - 90;
  57.    if(_loc1_.moveHow == 0 && _loc1_._y >= Stage.height / 3)
  58.    {
  59.       _loc1_.moveHow = 1;
  60.       _loc1_.route.reset(theHull._x - _loc1_._x,theHull._y - _loc1_._y);
  61.       _loc1_.turnTrigger = theHull._y;
  62.    }
  63.    else if(_loc1_.moveHow == 1)
  64.    {
  65.       if(_loc1_._y >= _loc1_.turnTrigger)
  66.       {
  67.          _loc1_.moveHow = 2;
  68.          _loc1_.route.reset(0,_loc1_.maxSpeed);
  69.       }
  70.    }
  71.    _loc1_.route.setLength(_loc1_.maxSpeed);
  72. }
  73.